﻿using System;

namespace Entities
{
    public enum SettingsType
    {
        Timezone = 1,
        Utility = 2,
        Project = 3,
        Vendor = 4,
        User = 5,
        Handheld = 6,
        VersionDatabase = 7,
        DataBaseType = 8,
        Inspector = 9,
        MaxMeterPerPole = 10,
        ReceptionMode = 11,
        DistributionAppMode = 12
    }

    public class ESetting : EBase
    {
        #region - Properties -

        public SettingsType SettingsType {get; set; }
        public string Name {get;set;}
        public int Value {get;set; }

        #endregion

        #region - Constructor -

        public ESetting ()
        {
            Name = string.Empty;
            Value = Int32.MinValue;
        }

        #endregion
    }

    public class ESettings
    {
        #region - Properties -

        public ESetting Timezone { get; set; }
        public ESetting Utility {get; set;}
        public ESetting Handheld { get; set; }
        public ESetting VersionDatabase { get; set; }

        public ESetting Project { get; set; }
        public ESetting Vendor { get; set; }
        public ESetting User { get; set; }
        public ESetting Inspector { get; set; }
        public DistributionApplicationMode DistributionApplicationMode { get; set; }
        public ESetting ReceptionMode { get; set; }

        public int MaxMeterPerPole { get; set; }

        public EVendor VendorEntity
        {
            get
            {
                EVendor vendor = new EVendor();

                vendor.Id = Vendor.Value;
                vendor.Name = Vendor.Name;

                return vendor;
            }
            set
            {
                    Vendor.Value = value.Id;
                    Vendor.Name = value.Name;
            }
        }

        public EUser UserEntity
        {
            get
            {
                EUser user = new EUser();

                user.Id = User.Value;
                user.Name = User.Name;

                return user;
            }
            set
            {
                    User.Value = value.Id;
                    User.Name = value.Name;
                            }
        }

        public EProject ProjectEntity
        {
            get
            {
                EProject project = new EProject();

                project.Id = Project.Value;
                project.Name = Project.Name;

                return project;
            }
            set
            {

                    Project.Value = value.Id;
                    Project.Name = value.Name;

            }
        }

        public ELookUp UtilityEntity
        {
            get
            {
                ELookUp lookUp = new ELookUp();

                lookUp.Value = Utility.Value;
                lookUp.Text = Utility.Name;
                lookUp.Type = LookUpType.UtilityName;

                return lookUp;
            }
            set
            {
                    Utility.Value = value.Value;
                    Utility.Name = value.Text;

            }
        }

        public ELookUp InspectorEntity
        {
            get
            {
                ELookUp lookUp = new ELookUp();

                lookUp.Value = Inspector.Value;
                lookUp.Text = Inspector.Name;
                lookUp.Type = LookUpType.Inspector;

                return lookUp;
            }
            set
            {
                    Inspector.Value = value.Value;
                    Inspector.Name = value.Text;

            }
        }

        #endregion
    }
}
